The DevOps 2.1 Toolkit by Viktor Farcic
Author:Viktor Farcic
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2017-05-03T07:32:07+00:00
Let's have a quick look at the metrics provided by the node-exporter service. We'll use the util service to retrieve the metrics:
UTIL_ID=$(docker ps -q --filter \
label=com.docker.swarm.service.name=util)
docker exec -it $UTIL_ID \
apk add --update curl drill
docker exec -it $UTIL_ID \
curl http://node-exporter:9100/metrics
A sample of the curl output is as follows:
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
...
As you can see, the metrics are in the Prometheus-friendly format. Please explore the Node Exporter collectors (https://github.com/prometheus/node_exporter#collectors) for more information about the meaning of each metric. For now, you should know that most of the node information you would need is available and will be, later on, scraped by Prometheus.
Since we sent a request through Docker networking, we got a load-balanced response and cannot be sure which node produced the output. When we reach the Prometheus configuration, we'll have to be more specific and skip networks load balancing.
Now that we have the information about servers, we should add metrics specific to containers. We'll use cAdvisor also known as container Advisor.
The cAdvisor provides container users an understanding of the resource usage and performance characteristics of their running containers. It is a running daemon that collects, aggregates, processes, and exports information about running containers. Specifically, for each container it keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage and network statistics. This data is exported container and machine-wide. It has native support for Docker containers.
Let's create the service:
docker service create --name cadvisor \
-p 8080:8080 \
--mode global \
--network proxy \
--mount "type=bind,source=/,target=/rootfs" \
--mount "type=bind,source=/var/run,target=/var/run" \
--mount "type=bind,source=/sys,target=/sys" \
--mount "type=bind,source=/var/lib/docker,target=/var/lib/docker" \
google/cadvisor:v0.24.1
Just as with the node-exporter, the cadvisor service is global and attached to the proxy network. It mounts a few directories that allows it to monitor Docker stats and events on the host. Since cAdvisor comes with a web UI, we opened port 8080 that will allow us to open it in a browser.
Before we proceed, we should confirm that the service is indeed running:
docker service ps cadvisor
The output of the service ps is as follows (IDs are removed for brevity):
NAME IMAGE NODE DESIRED STATE
cadvisor... google/cadvisor:v0.24.1 swarm-3 Running
cadvisor... google/cadvisor:v0.24.1 swarm-2 Running
cadvisor... google/cadvisor:v0.24.1 swarm-1 Running
cadvisor... google/cadvisor:v0.24.1 swarm-5 Running
cadvisor... google/cadvisor:v0.24.1 swarm-4 Running
--------------------------------------------------------
CURRENT STATE ERROR PORTS
Running 3 seconds ago
Running 3 seconds ago
Running 3 seconds ago
Running 8 seconds ago
Running 3 seconds ago
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Linux Device Driver Development Cookbook by Rodolfo Giometti(3958)
Embedded Programming with Modern C++ Cookbook by Igor Viarheichyk(3789)
Implementing Cellular IoT Solutions for Digital Transformation by Dennis McCain(3709)
Embedded Linux Development Using Yocto Project - Third Edition by Otavio Salvador & Daiane Angolini(3560)
TinyML Cookbook by Gian Marco Iodice(3475)
Simplifying 3D Printing with OpenSCAD by Colin Dow(2861)
TinyML Cookbook by Gian Marco Iodice & Ronan Naughton(2624)
Fusion 360 for Makers by Lydia Sloan Cline(2233)
Networking A Beginner's Guide by Bruce Hallberg(2230)
Hands-On Linux for Architects by Denis Salamanca(2075)
But How Do It Know? by J. Clark Scott(2039)
Computers For Seniors For Dummies by Nancy C. Muir(2023)
Raspberry Pi and MQTT Essentials by Dhairya Parikh(1981)
Arduino Project Handbook, Volume 2: 25 Simple Electronics Projects for Beginners by Geddes Mark(1963)
9781803246888-ENHANCING DEEP LEARNING WITH BAYESIAN INFERENCE by Unknown(1918)
Hack and HHVM by Owen Yamauchi(1904)
31 Days Before Your CompTIA A+ Exams (Shanette Luellen's Library) by Benjamin Patrick Conry(1878)
MicroPython Projects by Jacob Beningo(1768)
Hands-On Internet of Things with MQTT by Tim Pulver(1731)
